#version 130

varying float z;

void main()
{
	//Apply color
	gl_FragColor = gl_Color;

	//Apply a small red shade on the right side of the screen
	float shade = 0.02f *(gl_FragCoord.x /100.0);
	gl_FragColor.r += shade;
	gl_FragColor.b += shade/2;

	//Apply some fade-out on far away objects
	float fadeout = 0.2f *(z /30.0f);
	gl_FragColor.r -= fadeout *0.7f;
	gl_FragColor.g -= fadeout *0.9f;
	gl_FragColor.b -= fadeout *1.0f;
}
